// 云函数入口文件
const cloud = require('wx-server-sdk')
var rp = require('request-promise');

cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
})

// 云函数入口函数
exports.main = async(event, context) => {
  let appid = "wxbd001fdb45688f0d"
  let secret = "c13db42739d16ed5ac4a89df6a69b8c8"
  let url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' + appid + '&secret=' + secret
  return await rp(url).then(res => {
    return res
  })
}